From 31a0739bf39322dca8b22930640b23459c02e91f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sun, 4 Mar 2018 19:55:54 +0100 Subject: [PATCH] imcontextxim: Move initialisation into _init function We are creating these using g_object_new, so the _new function is never called, resulting in a NULL mb_charset. Fix this by moving the initialisation into the _init function. --- gtk/gtkimcontextxim.c | 25 +++++++------------------ gtk/gtkimcontextxim.h | 1 - 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/gtk/gtkimcontextxim.c b/gtk/gtkimcontextxim.c index 8c84c54146..caaaf03280 100644 --- a/gtk/gtkimcontextxim.c +++ b/gtk/gtkimcontextxim.c @@ -467,11 +467,18 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) static void gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim) { + const char *charset; + im_context_xim->use_preedit = TRUE; im_context_xim->filter_key_release = FALSE; im_context_xim->finalizing = FALSE; im_context_xim->has_focus = FALSE; im_context_xim->in_toplevel = FALSE; + + im_context_xim->locale = g_strdup (setlocale (LC_CTYPE, NULL)); + + g_get_charset (&charset); + im_context_xim->mb_charset = g_strdup (charset); } static void @@ -583,24 +590,6 @@ gtk_im_context_xim_set_client_widget (GtkIMContext *context, set_ic_client_window (context_xim, window); } -GtkIMContext * -gtk_im_context_xim_new (void) -{ - GtkIMContextXIM *result; - const gchar *charset; - - if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) - return NULL; - result = g_object_new (GTK_TYPE_IM_CONTEXT_XIM, NULL); - - result->locale = g_strdup (setlocale (LC_CTYPE, NULL)); - - g_get_charset (&charset); - result->mb_charset = g_strdup (charset); - - return GTK_IM_CONTEXT (result); -} - static char * mb_to_utf8 (GtkIMContextXIM *context_xim, const char *str) diff --git a/gtk/gtkimcontextxim.h b/gtk/gtkimcontextxim.h index 5965c65b00..4d31479d4b 100644 --- a/gtk/gtkimcontextxim.h +++ b/gtk/gtkimcontextxim.h @@ -40,7 +40,6 @@ struct _GtkIMContextXIMClass }; GType gtk_im_context_xim_get_type (void) G_GNUC_CONST; -GtkIMContext *gtk_im_context_xim_new (void); void gtk_im_context_xim_shutdown (void); G_END_DECLS -- 2.30.2